load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")

cc_binary(
    name = "librsi_generator.so",
    linkshared = True,
    linkstatic = False,
    deps = [":rsi_generator_lib"],
)

cc_library(
    name = "rsi_generator_lib",
    srcs = glob(["rsi_generator_component.cc",
            "affect_path/*.cc",]),
    hdrs = glob(["rsi_generator_component.h",
            "affect_path/*.h",
            "include/v2x-asn-msgs-adapter.hpp",
            "include/v2x-asn-msgs-asn_2.h",
            "include/v2x-asn-msgs-asn_3.h",
            "include/v2x-asn-msgs-common.h",]),
    linkopts = [
        "-pthread -lz -lrt -luuid"
    ],
    deps = [
        "@com_github_google_glog//:glog",
        "@fastrtps//:fastrtps",
        "@com_github_gflags_gflags//:gflags",
        "@airosrt//:airosrt",
        "@asn_wrapper",
        "//middleware/protocol/proto:v2xpb-asn-message-frame_cc_pb",
	    "//middleware/protocol/proto:v2xpb-config-event-details_cc_pb",
	    "//air_service/modules/proto:perception_cc_pb",
        "//middleware/protocol/common:global_conf",
        "//air_service/modules/perception-usecase/usecase/common:math",
    ],
    copts = [
        "-DUSE_CYBERRT",
	      "-DMODULE_NAME=\\\"rsi_generator\\\""
    ],
)

cc_test(
     name="rsi_generator_ut",
     srcs = [
        "ut/rsi_generator_component_test.cc",
        "rsi_generator_component.h",
     ],
    linkopts = [
        "-pthread -lz"
    ],
    deps=[
      "@com_google_googletest//:gtest_main",
      ":rsi_generator_lib",
    ],
    copts = [
        "-DUSE_CYBERRT"
    ],
    linkstatic = False,
)
